//----导出类型
export type {
  VueMetaEnv,
  TableColumn,
  TableSort,
  DialogRef,
  AppSettings,
  FileResponseReq,
  FilesReq,
} from "./types";
export type {
  EntityApi,
  EnumEntryReq,
  Entry,
  LayEntry,
  EntityReq,
  EntityModel,
  EntityList,
  EntityPage,
  EntityTotal,
  EntityKey,
  EntityKeyList,
  EntityCreateReq,
  EntityUpdateReq,
  EntityFormReq,
  EntityExportReq,
  EntityImportReq,
} from "./api/types";
export type {
  LoginData,
  LoginQrcodeResp,
  MyOrganList,
  MyOrganModel,
  RegisterReq,
  LoginResult,
  LoginQrcodeReq,
  ForgotPhoneEmailReq,
} from "./api/auth/types";

//----导出组件
import type { App } from "vue";

//util
import { cssImageVar } from "./settings";
//util
export {
  menus,
  vueMetaEnv,
  imageUrl,
  defaultSettings,
  addViteMenus,
  addWebpackMenus,
  updateMetaEnv,
  updateViteMetaEnv,
  updateWebpackMetaEnv,
  addDynamicRoute,
  updateSettings,
  cssImageVar,
} from "./settings";
export { getQueryParams, clearEmpty, deepMerge } from "./utils/grpc";

//API
import request, { axiosConfig } from "./utils/request";
export { request, axiosConfig };
export { generateRandomKey, handlePreview } from "./utils/common";
// 导出正则校验
export {
  validatePhoneNumber,
  validatePhoneOrLandline,
  validateCreditCode,
  validateIDCard,
  validateEmail,
} from "./utils/validation_utils";
export {
  BizDict,
  BizLayDict,
  CustomBizDict,
  EnumDict,
  enumMapCache,
  EnableBizDict,
} from "./api/index";

export {
  getCaptchaApi,
  createLoginQrcode,
  selectDsdRoles,
  runAsUser,
  myorganList,
  loginOrganApi,
  registerApi,
  loginApi,
  forgotPhoneEmail,
} from "./api/auth";
export { netEncrypt } from "./utils/netsecret";
export { fileApi } from "./api/file/index";
export { routerUtil } from "./utils/route";
export { SysApiImpl } from "./api/sys/index";

//hooks
export { useTableHooks, TableHooks } from "./hooks/table";

//store
export { store } from "./stores";
export { useAppStore, useAppStoreHook } from "./stores/modules/app";
export {
  usePermissionStore,
  usePermissionStoreHook,
} from "./stores/modules/permission";
export { useSettingsStore } from "./stores/modules/settings";
export { useTagsViewStore } from "./stores/modules/tagsView";
export { useUserStore, useUserStoreHook } from "./stores/modules/user";
export { useListStoreHook } from "./stores/modules/searchCondition";

//router
export { resetRouter, updateRouter } from "./router";
import routerRef from "./router";
export { routerRef };

//权限
import directive from "./directive";
export { directive };

//Page
export {
  Layout,
  LoginPage,
  MultiFactorLoginPage,
  ProfilePage,
  Error401Page,
  Error404Page,
  DashboardPage,
  RedirectPage,
  ChangeOrgan,
  RegisterPage,
} from "./router";

// 国际化
import i18n from "./lang/index";
export { i18n };

// 本地SVG图标
import * as LocalIcons from "./assets/components/index";
//element-plus图标
import * as ELIcons from "@element-plus/icons-vue";

// 样式
import "element-plus/theme-chalk/dark/css-vars.css";
import "./styles/index.scss";
import "uno.css";

//Components
// 表格组件
import JmashTable from "./components/JmashTable/index.vue";
import JmashColumnSelect from "./components/JmashColumnSelect/index.vue";
// 分页组件
import JmashPagination from "./components/JmashPagination/index.vue";
// 枚举下拉框
import JmashEnumSelect from "./components/JmashEnumSelect/index.vue";
import JmashUploadFile from "./components/JmashUploadFile/index.vue";
import JmashUploadImage from "./components/JmashUploadImage/index.vue";
// 单选框
import JmashEnumRadio from "./components/JmashEnumRadio/index.vue";
import IconSelect from "./components/IconSelect/index.vue";
// 手机号码脱敏组件
import JmashMobileInsComponent from "./components/JmashMobileInsComponent/index.vue";
// 单图上传
import JmashSingleImageUpload from "./components/JmashSingleImageUpload/index.vue";
// 附件上传组件
import JmashMultiUpload from "./components/JmashMultiUpload/index.vue";
// 多图片上传
import JmashMultiImageUpload from "./components/JmashMultiImageUpload/index.vue";
// 导入组件
import ImportUpload from "./components/JmashImportUpload/index.vue";
// 高德地图
import AMap from "./components/JmashAMap/index.vue";
// 腾讯地图
import TMaps from "./components/JmashTMaps/index.vue";
// 富文本
import JmashEditor from "./components/JmashEditor/index.vue";
// 注册组件
import RegisterForm from "./components/RegisterForm/index.vue";
// 忘记密码
import ForgotPwd from "./components/ForgotPwd/index.vue";

export { RegisterForm, ForgotPwd };
// 富文本编辑器类型导出
import type {
  IToolbarConfig,
  IEditorConfig,
  IDomEditor,
} from "@wangeditor-next/editor";
export type { IToolbarConfig, IEditorConfig, IDomEditor };

import Dictionary from "./components/Dictionary/index.vue";
import SvgIcon from "./components/SvgIcon/index.vue";
import LangSelect from "./components/LangSelect/index.vue";
import ElementPlus from "element-plus";
import "element-plus/theme-chalk/index.css";

// 全局注册Jmash-core插件.
const jmash = {
  async install(app: App) {
    app.use(ElementPlus);
    app.component("svg-icon", SvgIcon);
    // 注册SVG图标
    for (const [key, component] of Object.entries(LocalIcons)) {
      app.component(key, component);
    }
    //icons.
    for (const [key, component] of Object.entries(ELIcons)) {
      app.component(key, component);
    }
    app.component("dictionary", Dictionary);

    // 新组件引用.
    app.component("jmash-pagination", JmashPagination);
    app.component("jmash-single-image-upload", JmashSingleImageUpload);
    app.component("jmash-multi-upload", JmashMultiUpload);
    app.component("jmash-multi-image-upload", JmashMultiImageUpload);
    app.component("jmash-upload-file", JmashUploadFile);
    app.component("jmash-upload-image", JmashUploadImage);
    app.component("jmash-import-upload", ImportUpload);
    app.component("jmash-table", JmashTable);
    app.component("jmash-column-select", JmashColumnSelect);
    app.component("icon-select", IconSelect);
    app.component("lang-select", LangSelect);
    app.component("jmash-enum-select", JmashEnumSelect);
    app.component("jmash-enum-radio", JmashEnumRadio);
    app.component("jmash-mobileIns-component", JmashMobileInsComponent);
    app.component("import-upload", ImportUpload);
    app.component("jmash-amap", AMap);
    app.component("TMaps", TMaps);
    app.component("JmashEditor", JmashEditor);
    app.component("register-form", RegisterForm);
    app.component("forgot-pwd", ForgotPwd);

    //图片引用
    cssImageVar("--login-bg-url", "/core/images/login-bg.jpg");
  },
};
export default jmash;
